#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from store.mdb_store import TableStore


#
class ItJuZiInvestmentsProjectStore(TableStore):
    def __init__(self, config):
        self.table = config.get('table', 'juzi_investments')
        self.table_config = {
            'mdb': config['mdb'],
            'table': self.table,
            'column_dic': {
                'projectid': "varchar(255) NOT NULL DEFAULT '' COMMENT '工程id'",
                'name': "varchar(255) NOT NULL DEFAULT '' COMMENT '机构名称'",
                'sec_name': "varchar(255) NOT NULL DEFAULT '' COMMENT '机构名称'",
                'logo': "varchar(255) NOT NULL DEFAULT '' COMMENT 'logo'",
                'bg_img': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'credit_name': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'des': "text NOT NULL COMMENT '简介'",
                'url': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'year': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'month': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'num': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'capital_rmb': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'capital_dollar': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'fuzzy_rmb_id': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'fuzzy_dollar_id': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'rmb_scale_portfolio': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'dollar_scale_portfolio': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'invest_per_project_low': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'invest_per_project_high': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'invest_currency_id': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'email': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'has_report': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'prop': "text NOT NULL COMMENT ''",
                'regulate_capital': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'gp_info': "text NOT NULL COMMENT ''",
                'gp_total': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'billboard_info': "text NOT NULL COMMENT''",
                'single_investment_scale': "text NOT NULL COMMENT ''",
                'investment_round': "text NOT NULL COMMENT ''",
                'invse_round_list': "text NOT NULL COMMENT ''",
                'invse_cat_list': "text NOT NULL COMMENT ''",
                'has_follow': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'has_track': "varchar(255) NOT NULL DEFAULT '' COMMENT ''",
                'data': "text NOT NULL COMMENT ''",
                'scope': "text NOT NULL COMMENT ''",
                'fuzzy_dollar': "text NOT NULL COMMENT ''",
            },
            'uniq_idx_fields': ['projectid'],
            'idx_dic': {
                '{0}_name_idx'.format(self.table): ['name', 'sec_name']
            },
            'update_fields': [
                "name", "sec_name", "logo", 'bg_img', 'credit_name', 'des', 'url', 'year', 'month', "num", 'capital_rmb',
                "capital_dollar", "fuzzy_rmb_id", "fuzzy_dollar_id", "rmb_scale_portfolio", "dollar_scale_portfolio",
                "invest_per_project_low", "invest_per_project_high", "invest_currency_id", "email", "has_report",
                "prop", "regulate_capital", "gp_info", "gp_total", "billboard_info", "single_investment_scale",
                "investment_round", "invse_round_list", "invse_cat_list", "has_follow", "has_track", "data", "scope",
                "fuzzy_dollar"
            ],
            'text_fields': [
                "des", "prop", "single_investment_scale", 'investment_round', 'invse_round_list', 'invse_cat_list',
                'data', 'scope', 'fuzzy_dollar', 'billboard_info', 'gp_info'
            ],
            'dump_fields': [
                "des", "prop", "single_investment_scale", 'investment_round', 'invse_round_list', 'invse_cat_list',
                'data', 'scope', 'fuzzy_dollar', 'billboard_info', 'gp_info'
            ]
        }
        super(ItJuZiInvestmentsProjectStore, self).__init__(self.table_config)

